<?php

/**
 * NOTICE OF LICENSE
 *
 * THIS SOURCE FILE IS PART OF EVEBIT'S PRIVATE PROJECT.
 * 
 * DO NOT USE THIS FILE IN OTHER PLACE.
 *
 * @package   App_Sample
 * @author    Cheng Wei <berlios.o@gmail.com>
 * @version   $$Id: GetSortState.php 130 2011-03-18 03:10:02Z cheng.wei $$
 * @copyright Copyright (c) 2008 Evebit Inc. China (http://www.evebit.com)
 */

/**
 * Get state for sort column (backend gird)
 * 
 * @package   App_Sample
 * @author    Cheng Wei <berlios.o@gmail.com>
 * @version   $$Id: GetSortState.php 130 2011-03-18 03:10:02Z cheng.wei $$
 */
class Evebit_View_Helper_GetSortState extends Zend_View_Helper_Abstract {
	
	/**
	 * Get state
	 * 
	 * @param array $sort
	 * @param string $name
	 * @return string
	 */
	function getSortState($sort, $name) {
		if ($sort["key"] == $name) {
			if ($sort["order"] == 'asc') {
				return 'desc';
			} else {
				return 'asc';
			}
		} else {
			return 'asc';
		}
	}
}